package com.fudan.adse.controller;


import com.fudan.adse.api.CommonPage;
import com.fudan.adse.api.CommonResult;
import com.fudan.adse.domain.po.Cinema;
import com.fudan.adse.domain.vo.CinemaWithDetailVO;
import com.fudan.adse.service.CinemaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @author Jerry Zhang
 * create: 2022-11-25 14:03
 */
@RestController
@RequestMapping("/api/v1/cms/outer")
public class CinemaOuterController {
    private CinemaService cinemaService;

    /**
     * 按条件筛选影院信息，排除禁用影院
     *
     * @param locationId
     * @param locationDetail
     * @param pageNum
     * @param pageSize
     * @return
     */
    @GetMapping(value = "/cinemas")
    public CommonResult<CommonPage<CinemaWithDetailVO>> loadUserByMuseumCity(
            @RequestParam(value = "locationId", required = false) Integer locationId,
            @RequestParam(value = "locationDetail", required = false, defaultValue = "") String locationDetail,
            @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
            @RequestParam(value = "pageSize", required = false, defaultValue = "15") Integer pageSize) {
        return CommonResult.success(CommonPage.restPage(cinemaService.loadCinemaByLocation(locationId, locationDetail,
                true, pageNum, pageSize)));
    }


    @Autowired
    public void setMuseumService(CinemaService cinemaService) {
        this.cinemaService = cinemaService;
    }
}
